// Picture class : Defines "Picture" items

package appModel;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import javax.swing.JPanel;

public class Picture extends Item {

  private boolean selected = false;
  private Image picture;
  private Image selectedPicture;

  public Picture() {
    super();
  }

  public Picture(Image anImage, Image aSelImage) {
    this();
    picture = anImage;
    selectedPicture = aSelImage;
    this.setSize(anImage.getWidth(this), anImage.getHeight(this));
  }

  public Image getPicture(){
    return picture;
  }

  public void setPicture(Image anImage){
    picture = anImage;
  }

  public Image getSelectedPicture(){
    return selectedPicture;
  }

  public void setSelectedPicture(Image anImage){
    selectedPicture = anImage;
  }

  protected void paintComponent(Graphics g) {
    if (this.isSelected()) {
      g.drawImage(this.getSelectedPicture(), 0, 0, this.getWidth(), this.getHeight(), this);
    }
    else {
      g.drawImage(this.getPicture(), 0, 0, this.getWidth(), this.getHeight(), this);
    }
  }
}
